package ArrayQueue1;

import LinkedListQueue.LinkedListQueue;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class ArrayQueue1Test {
    ArrayQueue1<Integer> queue = new ArrayQueue1<Integer>(4);
    @Test
    void offer() {
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        assertIterableEquals(List.of(1,2,3,4),queue);
    }

    @Test
    void poll() {
        queue.offer(1);
        queue.offer(2);
        queue.offer(3);
        queue.offer(4);
        queue.offer(5);
        assertEquals(1,queue.poll());
        assertEquals(2,queue.poll());
        assertEquals(3,queue.poll());
        assertEquals(4,queue.poll());
        assertEquals(null,queue.poll());
        assertNull(queue.poll());
    }

    @Test
    void peek() {
        assertNull(queue.peek());
        queue.offer(1);
        assertEquals(1,queue.peek());
        queue.offer(2);
        assertEquals(1,queue.peek());
    }

    @Test
    void isEmpty() {
    }
}
